public class Test {
}


abstract class  Shape{
    public abstract void draw();

}
class Cycle extends Shape{
    @Override
    public void draw(){
        System.out.println("⚪");
    }
}
class Rect extends Shape{
    @Override
    public void draw() {
        System.out.println("矩形");
    }
}

public class Test {
    public static void drawMap(Shape shape){
        shape.draw();
    }
    public static void main(String[] args) {
        Shape shape= new Cycle();
        Shape shape1=new Rect();
        drawMap(shape);
        drawMap(shape1);


    }

}
package demo2;
public class Test {
    public static void  running(demo2.IRun iRun){
        iRun.run();
    }

    public static void main(String[] args) {
        running(new demo2.Dog("老二",11));
    }
}
package demo2;

        import org.omg.CORBA.PUBLIC_MEMBER;

abstract class Anmial {
    public String name;
    public  int age;
    public Anmial(String name, int age){
        this.age=age;
        this.name=name;
    }
}
interface  IFly{
    void fly();
}
interface  IRun{
    void run();
}
interface ISwim{
    void swim();
}
class Duck extends demo2.Anmial implements demo2.ISwim, demo2.IRun, demo2.IFly {
    public  Duck(String name,int age){
        super(name,age);
    }

    @Override
    public void run() {

    }

    @Override
    public void fly() {

    }

    @Override
    public void swim() {

    }
}
class Dog extends demo2.Anmial implements demo2.IRun {
    public  Dog(String name,int age){
        super(name,age);
    }

    @Override
    public void run() {
        System.out.println(this.name+"正在跑");
    }
}

